<template>
  <tr>
    <th><input type="checkbox" v-model="list.checked" /> <span></span></th>
    <th>{{ list.name }}</th>
    <th>{{ list.price }}</th>
    <th>
      <button @click="add">+</button> {{ list.num }}
      <button @click="red">-</button>
    </th>
    <th>{{ list.num * list.price }}</th>
    <th><button @click="del">删除</button></th>
  </tr>
</template>

<script>
export default {
  props: ["list", "index"],
  methods: {
    add() {
      this.$emit("addNum", this.index);
    },
    red() {
      this.$emit("redNum", this.index);
    },
    del() {
      this.$emit("delItem", this.index);
    },
  },
};
</script>

<style>
</style>